#!/usr/bin/env bash
# Run this script to copy over all the files of a (new) CompCert
# version into the vst repository.
#
# Usage:  cd vst/compcert; ../util/GRAB ~/compcert
# assuming it is ~/compcert where you have done the svn checkout
# of the compcert distribution (or repository)
#
# WARNING: This will first delete all the .v files of your
# current vst local copy!
#
#
if [ -e "$1" -a ./GRAB ]; then
  rm -f */*.v flocq/*/*.v
  mkdir -p x86 x86_32 x86_64 lib common cfrontend export
  mkdir -p flocq flocq/Core flocq/Prop flocq/Calc flocq/IEEE754
  cp $1/LICENSE $1/README.md $1/VERSION $1/Makefile.config .
  cp $1/x86/Builtins1.v x86
  cp $1/x86_32/Archi.v x86_32
  cp $1/x86_64/Archi.v x86_64
  cp $1/lib/*.v lib
  cp $1/common/*.v common
  cp $1/cfrontend/{Clight,ClightBigstep,Cop,Csem,Cstrategy,Csyntax,Ctypes}.v cfrontend
  cp $1/flocq/*.v flocq
  cp $1/flocq/Core/*.v flocq/Core
  cp $1/flocq/Prop/*.v flocq/Prop
  cp $1/flocq/Calc/*.v flocq/Calc
  cp $1/flocq/IEEE754/*.v flocq/IEEE754
  cp $1/export/*.v export
else
 echo "Usage:  ./GRAB ~/compcert"
fi
